#pragma once

#include "database/Manager.h"
#include "database/AdoRecordSet.h"

class CRecord
{
public:
	CRecord( );
	~CRecord( );

public:
	void SetConnPool( int index = 0 );
	void SetConnPool( const CString poolName );

	BOOL Select( const CString & strSql );

public:
	int RowCount( );
	int ColumnCount( );

	DataTypeEnum GetFieldType( long index );
	DataTypeEnum GetFieldType( LPCTSTR lpszFieldName );

	bool GetAt( int row , int col , int & value );
	bool GetAt( int row , int col , float & value );
	bool GetAt( int row , int col , double & value );
	bool GetAt( int row , int col , CString & value );
	bool GetData( int row , int col , _variant_t & value );

	bool SetAt( int row , int col , int value );
	bool SetAt( int row , int col , float value );
	bool SetAt( int row , int col , double value );
	bool SetAt( int row , int col , const CString & value );
	bool SetData( int row , int col , const _variant_t & value );

protected:
	void RemoveConnPool( );

protected:
	CString m_poolName;
	CAdoRecordSet m_recordSet;
	CAdoConnection * m_pConnection;
};

